package com.truesai.entities.inventory;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.truesai.entities.customer.Provider;
import com.truesai.entities.production.Production;
import com.truesai.entities.stock.Warehouse;

/**
 * 产品入库存详细信息<br/>
 * 需求分析<br/>
 * <strong>唯一性:</strong>产品id，日期，入往仓库。
 * 该表主要记录产品的入库信息，主要针对的是采购完成付款，到统计产品总数量计算完成的时间段所发生的业务。
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = InventoryDetail.ALL, query = "Select d from InventoryDetail d"),
        @NamedQuery(name = InventoryDetail.BY_PRODUCTION, query = "Select d from InventoryDetail d where d.production = :production"),
        @NamedQuery(name = InventoryDetail.BY_ID, query = "Select d from InventoryDetail d where d.id = :id") })
@Table(name = "Inventory_details")
public class InventoryDetail {
	public static final String ALL = "InventoryDetail.all";

    public static final String BY_PRODUCTION = "InventoryDetail.byProduction";

    public static final String BY_ID = "InventoryDetail.byId";
    

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**批次*/
    @ManyToOne
    private Inventory inventory;
    
    /**产品*/
    @ManyToOne
    private Production production;
    
    /**数量*/
    @Column
    private BigDecimal amount;
    
    /**批次*/
    @Column
    private String batch;
    
    /**进价*/
    @Column
    private BigDecimal inPrice;
    
    /**存放仓库*/
    @ManyToOne
    private Warehouse warehouse;
    
    /**供应商*/
    @ManyToOne
    private Provider provider;
    
    /**总进价*/
    @Column
    private BigDecimal totalPrice;
    
    /**实支付总进价*/
    @Column
    private BigDecimal factTotalPrice;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Production getProduction() {
		return production;
	}

	public void setProduction(Production production) {
		this.production = production;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public String getBatch() {
		return batch;
	}

	public void setBatch(String batch) {
		this.batch = batch;
	}

	public BigDecimal getInPrice() {
		return inPrice;
	}

	public void setInPrice(BigDecimal inPrice) {
		this.inPrice = inPrice;
	}

	public Provider getProvider() {
		return provider;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}

	public BigDecimal getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(BigDecimal totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}
    
}
